var config = require('./config/index.js');

var kafka = require('kafka-node');
var Consumer = kafka.Consumer;
// var Consumer = kafka.HighLevelConsumer;

var client = new kafka.Client(config.zookeeper.uri);

var __topic = 't1';
// ---create consumer
var consumer = new Consumer(client, [{
	topic: __topic,
	partition: 0
}], {
	autoCommit: false
});

consumer.on('error', function(err) {
	console.log('consumer error:', err);
});

consumer.on('message', function(msg) {
	console.log('consumer get msg:', msg);
});

consumer.addTopics(__topic,function(err,data){
	console.log('aa');
});